package com.circle.interests.biz.enums;

import lombok.Getter;

/**
 * @author zhou
 * @date 2021/1/15
 */
public enum InventoryOperateTypeEnum {
    /**
     * 奖品状态
     */
    ALLOCATION(1, "库存分配"),
    INCREASE(2, "库存调整-增加"),
    DECREASE(3, "库存调整-减少"),
    RECYCLE(4, "库存回收");

    @Getter
    private final Integer code;
    @Getter
    private final String info;

    InventoryOperateTypeEnum(Integer code, String info) {
        this.code = code;
        this.info = info;
    }

    public static InventoryOperateTypeEnum getByCode(Integer code) {
        return getByCode(code, null);
    }

    public static InventoryOperateTypeEnum getByCode(Integer code, InventoryOperateTypeEnum defaultValue) {
        for (InventoryOperateTypeEnum e : InventoryOperateTypeEnum.values()) {
            if (e.code.equals(code)) {
                return e;
            }
        }
        return defaultValue;
    }
}
